package Vista;
import Controlador.handlerVentAsigElimAlu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import Controlador.Sistema;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentAsignarEliminarAlumnoCurso extends javax.swing.JFrame {
	private JLabel lblNumeroCurso;
	private JLabel lblAlumno;
	private JTextField txtNumero;
	private JTextField txtLegajo;
	private JButton btnSalir;
	private JButton btnEliminar;
	private JButton btnAsignar;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public VentAsignarEliminarAlumnoCurso() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Asignar Alumno");
			getContentPane().setLayout(null);
			{
				lblNumeroCurso = new JLabel();
				getContentPane().add(lblNumeroCurso);
				lblNumeroCurso.setText("Numero de Curso: ");
				lblNumeroCurso.setBounds(51, 64, 128, 14);
			}
			{
				lblAlumno = new JLabel();
				getContentPane().add(lblAlumno);
				lblAlumno.setText("Legajo: ");
				lblAlumno.setBounds(51, 126, 128, 14);
			}
			{
				txtNumero = new JTextField();
				getContentPane().add(txtNumero);
				txtNumero.setBounds(216, 57, 108, 21);
			}
			{
				txtLegajo = new JTextField();
				getContentPane().add(txtLegajo);
				txtLegajo.setBounds(216, 119, 108, 21);
			}
			{
				btnSalir = new JButton();
				getContentPane().add(btnSalir);
				btnSalir.setText("Salir");
				btnSalir.setBounds(146, 217, 111, 21);
				btnSalir.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						dispose();
					}
				});
			}
			{
				btnAsignar = new JButton();
				getContentPane().add(btnAsignar);
				btnAsignar.setText("Asignar a curso");
				btnAsignar.setBounds(34, 164, 145, 21);
				btnAsignar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						handlerVentAsigElimAlu h = new handlerVentAsigElimAlu();
						h.asignar(Integer.parseInt(txtLegajo.getText()), Integer.parseInt(txtNumero.getText()));
					}
				});
			}
			{
				btnEliminar = new JButton();
				getContentPane().add(btnEliminar);
				btnEliminar.setText("Eliminar de Curso");
				btnEliminar.setBounds(216, 164, 144, 21);
				btnEliminar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						handlerVentAsigElimAlu h = new handlerVentAsigElimAlu();
						h.eliminar(Integer.parseInt(txtLegajo.getText()), Integer.parseInt(txtNumero.getText()));
					}
				});
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private void btnAsignarActionPerformed(ActionEvent evt) {
		System.out.println("btnAsignar.actionPerformed, event="+evt);
		//TODO add your code for btnAsignar.actionPerformed
	}

}
